package online.hxstar.learn.util;

/**
 * @author huxing
 * @date 2018-12-17 11:55
 */
public class AppUtils {
    /**
     * 设置端口口好
     *
     * @param args 数组
     * @return 端口号
     */
    public static int getPort(String[] args) {
        int port = 4040;
        if (args != null && args.length > 0) {
            try {
                port = Integer.parseInt(args[0]);
            } catch (Exception ignored) {
            }
        }
        return port;
    }

    public static String getUrl(String[] args, String defaultUrl) {
        if (args != null && args.length > 1) {
            return args[1];
        }
        return defaultUrl;
    }
}
